Public Class frmDELIVERY_INFO
    Dim index As Integer = 1
    Public DeliveryDate As Date
    Public EMP_CODE As String = ""
    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub

    Private Sub frmDELIVERY_INFO_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        Try
            GC.Collect()
            Me.Dispose()
        Catch ex As Exception

        End Try
    End Sub

    Private Sub frmOpenItem_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        PublicFunction.NewFormLoad(Me)
        DeliveryDate = Now.Date
        txtDeliveryDate.Text = DeliveryDate.ToString(PublicVariable.DateTimeFormat)
    End Sub

    Private Sub Keyboardcontrol1_UserKeyPressed(ByVal sender As System.Object, ByVal e As VINAPOS.KeyboardClassLibrarySmall.KeyboardEventArgs) Handles Keyboardcontrol1.UserKeyPressed
        Select Case index
            Case 1
                txtCustomerName.Focus()
            Case 2
                txtDeliveryDate.Focus()
            Case 3
                txtPhone.Focus()
            Case 4
                txtAddress.Focus()
            Case 5
                txtRemark.Focus()
        End Select
        SendKeys.Send(e.KeyboardKeyPressed)
    End Sub

    Private Sub txtCustomerName_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCustomerName.Enter
        index = 1
    End Sub

    Private Sub txtDeliveryDate_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDeliveryDate.Enter
        index = 2
    End Sub

    Private Sub txtPhone_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPhone.Enter
        index = 3
    End Sub

    Private Sub txtAddress_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAddress.Enter
        index = 4
    End Sub

    Private Sub txtRemark_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtRemark.Enter
        index = 5
    End Sub

    Private Sub btnDate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDate.Click
        Dim frm As New frmCalendar
        frm.ShowDialog()
        DeliveryDate = frm.Calendar2.SelectionRange.Start
        txtDeliveryDate.Text = DeliveryDate.ToString(PublicVariable.DateTimeFormat)
    End Sub

    Private Sub btnEmp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEmp.Click
        Dim frm As New frmEMPLOYEE
        If frm.ShowDialog = Windows.Forms.DialogResult.OK Then
            Me.EMP_CODE = frm.GridEmployee.GetValue("EMP_CODE").ToString
        End If
    End Sub
End Class